package 笔试.神策;

import java.util.*;

/**
 * @author:谢君臣
 * @Date:2021/9/8-15:43
 * @version:1.0
 * @function:
 */
public class Main03 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()){
            fun(scanner.nextLine());
        }
    }

    private static void fun(String nextLine) {
        int count = 0;
        char[] chars = nextLine.toCharArray();
        for (int i = 0; i < chars.length; i++)
            if (chars[i]=='('||chars[i]==')') count++;
        System.out.println(count/2);
        Deque<Integer> stack1 = new LinkedList<>();
        Deque<Integer> stack2 = new LinkedList<>();
        ArrayList<List<Integer>> list = new ArrayList<>();
        for (int i = 0; i < chars.length; i++) {
            if (chars[i]=='(')stack1.push(i);
            if (chars[i]==')'){
                stack2.offer(i);
                ArrayList<Integer> list1 = new ArrayList<>();
                list1.add(stack1.pop());
                list1.add(stack2.poll());
                list.add(list1);
            }
        }
        Collections.sort(list,(l1,l2)->{
            return l1.get(0)-l2.get(0);
        });
        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i).get(0));
            System.out.println(list.get(i).get(1));
        }
    }
}
